<template>
  <div id="demo">
    <!--<img src="./assets/logo.png">-->
    <router-link v-bind:to="{path:'carDetail'}">
      <button class="btn btn-default" v-on:click="list">点击跳转</button>
    </router-link>
    <a href="listCar">跳转</a>
    <ul>
      <li><router-link  to="/" >首页</router-link></li>
      <li><router-link  to="/carDetail" >汽车详情</router-link></li>
      <li><router-link  to="/listCar" >汽车列表</router-link></li>
      <li><button v-on:click="send">发送请求</button></li>
    </ul>
    {{result}}
    <!-- <ul>
       <li v-for="site in result" v-bind:key="site.Detail" >
         {{ site.Detail }}
       </li>
     </ul>-->

    <router-view/>

  </div>
</template>

<script>
  import axios from 'axios'

  export default {
    name: 'App',
    data(){
      return {
        code :'1111',
        message:'19',
        result:''
      }
    },
    methods: {
      send:function(){
        axios.post('/api/pic-consumer-product/product/1001569845632448')
          .then(response => {
            /*this.code = response.data.code;*/
            /*document.write(response.data.result);*/
            this.result = response.data.result;
            console.log(response.data);
          })
          .catch(err => {
            console.log(err);
          });
      },
      list:function(){alert(1)
        location.reload();
        //this.$router.push({name: '/listCar'});
      }
    }
  }
</script>

<style>
  #app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
  }
</style>
